package com.example.xiangmuservice.controller;

import com.example.xiangmuservice.entity.App;
import com.example.xiangmuservice.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class AppController {

    @Autowired
    private AppService appService;

    @GetMapping("/app")
    public App insertApp(App app){
        App saveApp = appService.insertApp(app);
        return saveApp;
    }

    @GetMapping("/app/{id}")
    public App getApp(@PathVariable("id") Integer id){
        App app = appService.findById(id);
        return app;
    }


}
